package com.kinghood.productcenter.controller.product;

import com.kinghood.infrastructure.api.authority.SysLogModuleEnum;
import com.kinghood.infrastructure.aspect.OperatorLog;
import com.kinghood.infrastructure.model.KingHoodResponseVO;
import com.kinghood.productcenter.common.model.dto.product.GetUserSearchSettingReqDTO;
import com.kinghood.productcenter.common.model.vo.product.GetUserSearchSettingVO;
import com.kinghood.productcenter.common.model.vo.product.SearchSettingVO;
import com.kinghood.productcenter.common.model.dto.product.UserSearchSettingReqDTO;
import com.kinghood.productcenter.service.product.IUserSearchSettingService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author KingHood
 * @since 2024-01-15
 */
@RequiredArgsConstructor
@RestController
@RequestMapping("/userSearchSetting")
public class UserSearchSettingController {

    private final IUserSearchSettingService userSearchSettingService;


    /**
     * 保存搜索配置
     *
     * @param in 入参
     * @return 配置id
     * @author zfj
     * @date 2024/01/15
     */
    @OperatorLog(module = SysLogModuleEnum.Type.PRODUCT_PRODUCT,content = "商品管理-保存搜索设置")
    @PostMapping("/saveUserSearchSetting")
    public KingHoodResponseVO<Boolean> saveUserSearchSetting(@Valid @RequestBody UserSearchSettingReqDTO in) {

        return KingHoodResponseVO.success(userSearchSettingService.saveUserSearchSetting(in));
    }

    /**
     * 搜索配置获取
     *
     * @param in 入参
     * @return 配置
     * @author zfj
     * @date 2024/01/15
     */
    @PostMapping("/getUserSearchSetting")
    public KingHoodResponseVO<GetUserSearchSettingVO> getUserSearchSetting(@Valid @RequestBody GetUserSearchSettingReqDTO in) {

        return KingHoodResponseVO.success(userSearchSettingService.getUserSearchSetting(in));
    }

}
